{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "360RD6-wzNiR"
   },
   "source": [
    "![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png)\n",
    "\n",
    "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/colab/healthcare/assertion/assertion_overview.ipynb)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "uv_9xSABoHKk"
   },
   "source": [
    "# Assert statuses of medical entities\n",
    "\n",
    "`Assert` for each `entity` the status into one out of `C` classes.  These classes usually are : ``hypothetical``, ``present``, ``absent``, ``possible``, ``conditional``, ``associated_with_someone_else``.\n",
    "\n",
    "\n",
    "All the models avaiable are :\n",
    "\n",
    "| Language | nlu.load() reference                                         | Spark NLP Model reference          |\n",
    "| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ |\n",
    "| English  | [assert](https://nlp.johnsnowlabs.com/2021/01/26/assertion_dl_en.html) | [assertion_dl](https://nlp.johnsnowlabs.com/2021/01/26/assertion_dl_en.html)                   |\n",
    "| English  | [assert.biobert](https://nlp.johnsnowlabs.com/2021/01/26/assertion_dl_biobert_en.html) | [assertion_dl_biobert](https://nlp.johnsnowlabs.com/2021/01/26/assertion_dl_biobert_en.html)                   |\n",
    "| English  | [assert.healthcare](https://nlp.johnsnowlabs.com/2020/09/23/assertion_dl_healthcare_en.html) | [assertion_dl_healthcare](https://nlp.johnsnowlabs.com/2020/09/23/assertion_dl_healthcare_en.html)                   |\n",
    "| English  | [assert.large](https://nlp.johnsnowlabs.com/2020/05/21/assertion_dl_large_en.html) | [assertion_dl_large](https://nlp.johnsnowlabs.com/2020/05/21/assertion_dl_large_en.html)                   |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "8N25QLgLR13F"
   },
   "outputs": [],
   "source": [
    "from johnsnowlabs import nlp\n",
    "\n",
    "# After uploading your license run this to install all licensed Python Wheels and pre-download Jars the Spark Session JVM\n",
    "nlp.install()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "rSUTBWKi6Hb-"
   },
   "source": [
    "#### [Detect Assertion Status (assertion_dl) - supports confidence scores.](https://nlp.johnsnowlabs.com/2021/01/26/assertion_dl_en.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "emvKNnXE6HBv",
    "outputId": "04d004dd-89d5-43aa-e09f-c49215b111ae"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning::Spark Session already created, some configs may not take.\n",
      "Warning::Spark Session already created, some configs may not take.\n",
      "ner_clinical download started this may take some time.\n",
      "[OK!]\n",
      "assertion_dl download started this may take some time.\n",
      "[OK!]\n",
      "embeddings_clinical download started this may take some time.\n",
      "Approximate size to download 1.6 GB\n",
      "[OK!]\n",
      "Warning::Spark Session already created, some configs may not take.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-eba71549-1d74-4b86-84c3-9a5e5c53531a\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>assertion</th>\n",
       "      <th>assertion_confidence</th>\n",
       "      <th>document</th>\n",
       "      <th>entities_clinical</th>\n",
       "      <th>entities_clinical_class</th>\n",
       "      <th>entities_clinical_confidence</th>\n",
       "      <th>entities_clinical_origin_chunk</th>\n",
       "      <th>entities_clinical_origin_sentence</th>\n",
       "      <th>word_embedding_glove</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>conditional</td>\n",
       "      <td>0.999</td>\n",
       "      <td>The human KCNJ9 (Kir 3.3, GIRK3) is a member o...</td>\n",
       "      <td>the G-protein-activated inwardly rectifying po...</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.69259995</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.0823686420917511, -0.3178570866584778, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9991</td>\n",
       "      <td>Here we describe the genomicorganization of th...</td>\n",
       "      <td>the genomicorganization</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.80715</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.40810859203338623, -0.34884893894195557, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>present</td>\n",
       "      <td>0.7837</td>\n",
       "      <td>Here we describe the genomicorganization of th...</td>\n",
       "      <td>a candidate gene forType II diabetes mellitus</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.7543429</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.40810859203338623, -0.34884893894195557, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>absent</td>\n",
       "      <td>0.8066</td>\n",
       "      <td>The gene spansapproximately 7.6 kb and contain...</td>\n",
       "      <td>byapproximately</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.7924</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.0823686420917511, -0.3178570866584778, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9996</td>\n",
       "      <td>We identified14 single nucleotide polymorphism...</td>\n",
       "      <td>single nucleotide polymorphisms</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.71396667</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.2036844938993454, -0.39434725046157837, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>present</td>\n",
       "      <td>0.942</td>\n",
       "      <td>We identified14 single nucleotide polymorphism...</td>\n",
       "      <td>aVal366Ala substitution</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.5978</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.2036844938993454, -0.39434725046157837, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>present</td>\n",
       "      <td>0.969</td>\n",
       "      <td>We identified14 single nucleotide polymorphism...</td>\n",
       "      <td>an 8 base-pair</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.40433335</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.2036844938993454, -0.39434725046157837, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>present</td>\n",
       "      <td>0.6746</td>\n",
       "      <td>(bp) insertion/deletion.</td>\n",
       "      <td>insertion/deletion</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.985</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.058002080768346786, 0.14185668528079987, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9991</td>\n",
       "      <td>Ourexpression studies revealed the presence of...</td>\n",
       "      <td>Ourexpression studies</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.89975</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9998</td>\n",
       "      <td>Ourexpression studies revealed the presence of...</td>\n",
       "      <td>the transcript in various humantissues</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.83305997</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>possible</td>\n",
       "      <td>0.9952</td>\n",
       "      <td>Ourexpression studies revealed the presence of...</td>\n",
       "      <td>fat andskeletal muscle</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.77813333</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>present</td>\n",
       "      <td>0.6824</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>furtherstudies</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.8789</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.0823686420917511, -0.3178570866584778, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9997</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>the KCNJ9 protein</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.5610333</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.0823686420917511, -0.3178570866584778, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>possible</td>\n",
       "      <td>0.7588</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>evaluation</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.9981</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.0823686420917511, -0.3178570866584778, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9839</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>Type II diabetes</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.6989667</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.0823686420917511, -0.3178570866584778, 0....</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-eba71549-1d74-4b86-84c3-9a5e5c53531a')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-eba71549-1d74-4b86-84c3-9a5e5c53531a button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-eba71549-1d74-4b86-84c3-9a5e5c53531a');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "\n",
       "<div id=\"df-297c3954-bfd5-426d-8165-82b52b0a9d9b\">\n",
       "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-297c3954-bfd5-426d-8165-82b52b0a9d9b')\"\n",
       "            title=\"Suggest charts.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "  </button>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "      --bg-color: #E8F0FE;\n",
       "      --fill-color: #1967D2;\n",
       "      --hover-bg-color: #E2EBFA;\n",
       "      --hover-fill-color: #174EA6;\n",
       "      --disabled-fill-color: #AAA;\n",
       "      --disabled-bg-color: #DDD;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "      --bg-color: #3B4455;\n",
       "      --fill-color: #D2E3FC;\n",
       "      --hover-bg-color: #434B5C;\n",
       "      --hover-fill-color: #FFFFFF;\n",
       "      --disabled-bg-color: #3B4455;\n",
       "      --disabled-fill-color: #666;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart {\n",
       "    background-color: var(--bg-color);\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: var(--fill-color);\n",
       "    height: 32px;\n",
       "    padding: 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: var(--hover-bg-color);\n",
       "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: var(--button-hover-fill-color);\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart-complete:disabled,\n",
       "  .colab-df-quickchart-complete:disabled:hover {\n",
       "    background-color: var(--disabled-bg-color);\n",
       "    fill: var(--disabled-fill-color);\n",
       "    box-shadow: none;\n",
       "  }\n",
       "\n",
       "  .colab-df-spinner {\n",
       "    border: 2px solid var(--fill-color);\n",
       "    border-color: transparent;\n",
       "    border-bottom-color: var(--fill-color);\n",
       "    animation:\n",
       "      spin 1s steps(1) infinite;\n",
       "  }\n",
       "\n",
       "  @keyframes spin {\n",
       "    0% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "      border-left-color: var(--fill-color);\n",
       "    }\n",
       "    20% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    30% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    40% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    60% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    80% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "    90% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "  }\n",
       "</style>\n",
       "\n",
       "  <script>\n",
       "    async function quickchart(key) {\n",
       "      const quickchartButtonEl =\n",
       "        document.querySelector('#' + key + ' button');\n",
       "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
       "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
       "      try {\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      } catch (error) {\n",
       "        console.error('Error during call to suggestCharts:', error);\n",
       "      }\n",
       "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
       "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
       "    }\n",
       "    (() => {\n",
       "      let quickchartButtonEl =\n",
       "        document.querySelector('#df-297c3954-bfd5-426d-8165-82b52b0a9d9b button');\n",
       "      quickchartButtonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "    })();\n",
       "  </script>\n",
       "</div>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "     assertion assertion_confidence  \\\n",
       "0  conditional                0.999   \n",
       "1      present               0.9991   \n",
       "1      present               0.7837   \n",
       "2       absent               0.8066   \n",
       "3      present               0.9996   \n",
       "3      present                0.942   \n",
       "3      present                0.969   \n",
       "4      present               0.6746   \n",
       "5      present               0.9991   \n",
       "5      present               0.9998   \n",
       "5     possible               0.9952   \n",
       "6      present               0.6824   \n",
       "6      present               0.9997   \n",
       "6     possible               0.7588   \n",
       "6      present               0.9839   \n",
       "\n",
       "                                            document  \\\n",
       "0  The human KCNJ9 (Kir 3.3, GIRK3) is a member o...   \n",
       "1  Here we describe the genomicorganization of th...   \n",
       "1  Here we describe the genomicorganization of th...   \n",
       "2  The gene spansapproximately 7.6 kb and contain...   \n",
       "3  We identified14 single nucleotide polymorphism...   \n",
       "3  We identified14 single nucleotide polymorphism...   \n",
       "3  We identified14 single nucleotide polymorphism...   \n",
       "4                           (bp) insertion/deletion.   \n",
       "5  Ourexpression studies revealed the presence of...   \n",
       "5  Ourexpression studies revealed the presence of...   \n",
       "5  Ourexpression studies revealed the presence of...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "\n",
       "                                   entities_clinical entities_clinical_class  \\\n",
       "0  the G-protein-activated inwardly rectifying po...               TREATMENT   \n",
       "1                            the genomicorganization               TREATMENT   \n",
       "1      a candidate gene forType II diabetes mellitus                 PROBLEM   \n",
       "2                                    byapproximately               TREATMENT   \n",
       "3                    single nucleotide polymorphisms               TREATMENT   \n",
       "3                            aVal366Ala substitution               TREATMENT   \n",
       "3                                     an 8 base-pair               TREATMENT   \n",
       "4                                 insertion/deletion                 PROBLEM   \n",
       "5                              Ourexpression studies                    TEST   \n",
       "5             the transcript in various humantissues                 PROBLEM   \n",
       "5                             fat andskeletal muscle                 PROBLEM   \n",
       "6                                     furtherstudies                 PROBLEM   \n",
       "6                                  the KCNJ9 protein               TREATMENT   \n",
       "6                                         evaluation                    TEST   \n",
       "6                                   Type II diabetes                 PROBLEM   \n",
       "\n",
       "  entities_clinical_confidence entities_clinical_origin_chunk  \\\n",
       "0                   0.69259995                              0   \n",
       "1                      0.80715                              0   \n",
       "1                    0.7543429                              1   \n",
       "2                       0.7924                              0   \n",
       "3                   0.71396667                              0   \n",
       "3                       0.5978                              1   \n",
       "3                   0.40433335                              2   \n",
       "4                        0.985                              0   \n",
       "5                      0.89975                              0   \n",
       "5                   0.83305997                              1   \n",
       "5                   0.77813333                              2   \n",
       "6                       0.8789                              0   \n",
       "6                    0.5610333                              1   \n",
       "6                       0.9981                              2   \n",
       "6                    0.6989667                              3   \n",
       "\n",
       "  entities_clinical_origin_sentence  \\\n",
       "0                                 0   \n",
       "1                                 0   \n",
       "1                                 0   \n",
       "2                                 0   \n",
       "3                                 0   \n",
       "3                                 0   \n",
       "3                                 0   \n",
       "4                                 0   \n",
       "5                                 0   \n",
       "5                                 0   \n",
       "5                                 0   \n",
       "6                                 0   \n",
       "6                                 0   \n",
       "6                                 0   \n",
       "6                                 0   \n",
       "\n",
       "                                word_embedding_glove  \n",
       "0  [[-0.0823686420917511, -0.3178570866584778, 0....  \n",
       "1  [[0.40810859203338623, -0.34884893894195557, 0...  \n",
       "1  [[0.40810859203338623, -0.34884893894195557, 0...  \n",
       "2  [[-0.0823686420917511, -0.3178570866584778, 0....  \n",
       "3  [[0.2036844938993454, -0.39434725046157837, 0....  \n",
       "3  [[0.2036844938993454, -0.39434725046157837, 0....  \n",
       "3  [[0.2036844938993454, -0.39434725046157837, 0....  \n",
       "4  [[-0.058002080768346786, 0.14185668528079987, ...  \n",
       "5  [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,...  \n",
       "5  [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,...  \n",
       "5  [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,...  \n",
       "6  [[-0.0823686420917511, -0.3178570866584778, 0....  \n",
       "6  [[-0.0823686420917511, -0.3178570866584778, 0....  \n",
       "6  [[-0.0823686420917511, -0.3178570866584778, 0....  \n",
       "6  [[-0.0823686420917511, -0.3178570866584778, 0....  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nlp.load(\"en.med_ner.clinical en.assert\").predict(['The human KCNJ9 (Kir 3.3, GIRK3) is a member of the G-protein-activated inwardly rectifying potassium (GIRK) channel family.',\n",
    " 'Here we describe the genomicorganization of the KCNJ9 locus on chromosome 1q21-23 as a candidate gene forType II diabetes mellitus in the Pima Indian population.',\n",
    "'The gene spansapproximately 7.6 kb and contains one noncoding and two coding exons separated byapproximately 2.2 and approximately 2.6 kb introns, respectively.',\n",
    "   'We identified14 single nucleotide polymorphisms (SNPs), including one that predicts aVal366Ala substitution, and an 8 base-pair',\n",
    "   '(bp) insertion/deletion.', 'Ourexpression studies revealed the presence of the transcript in various humantissues including pancreas, and two major insulin-responsive tissues: fat andskeletal muscle.',\n",
    "   'The characterization of the KCNJ9 gene should facilitate furtherstudies on the function of the KCNJ9 protein and allow evaluation of thepotential role of the locus in Type II diabetes.'],output_level =  \"chunk\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "OXTlByOz6TLg"
   },
   "source": [
    "#### [Detect Assertion Status (assertion_dl_biobert) - supports confidence scores.](https://nlp.johnsnowlabs.com/2021/01/26/assertion_dl_biobert_en.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "EQUUl_Sk6TLh",
    "outputId": "5be1eeaa-98ba-40f7-97d3-ce8f43cf7d2a"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning::Spark Session already created, some configs may not take.\n",
      "Warning::Spark Session already created, some configs may not take.\n",
      "ner_clinical_biobert download started this may take some time.\n",
      "[OK!]\n",
      "assertion_dl_biobert download started this may take some time.\n",
      "[OK!]\n",
      "biobert_pubmed_base_cased download started this may take some time.\n",
      "Approximate size to download 386.4 MB\n",
      "[OK!]\n",
      "Warning::Spark Session already created, some configs may not take.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-d908b758-f5d0-4c10-87d2-2f0942ab02e1\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>assertion</th>\n",
       "      <th>assertion_confidence</th>\n",
       "      <th>document</th>\n",
       "      <th>entities_clinical</th>\n",
       "      <th>entities_clinical_class</th>\n",
       "      <th>entities_clinical_confidence</th>\n",
       "      <th>entities_clinical_origin_chunk</th>\n",
       "      <th>entities_clinical_origin_sentence</th>\n",
       "      <th>word_embedding_biobert</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>The human KCNJ9 (Kir 3.3, GIRK3) is a member o...</td>\n",
       "      <td>The human KCNJ9 (Kir</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.57887995</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.24800854921340942, 0.17330020666122437, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>The human KCNJ9 (Kir 3.3, GIRK3) is a member o...</td>\n",
       "      <td>the G-protein-activated inwardly rectifying po...</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.50720996</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.24800854921340942, 0.17330020666122437, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>Here we describe the genomicorganization of th...</td>\n",
       "      <td>the KCNJ9 locus</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.37636665</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.013393104076385498, 0.005851382855325937, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>associated_with_someone_else</td>\n",
       "      <td>0.9859</td>\n",
       "      <td>Here we describe the genomicorganization of th...</td>\n",
       "      <td>II diabetes mellitus</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.8784333</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.013393104076385498, 0.005851382855325937, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The gene spansapproximately 7.6 kb and contain...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[[-0.5425839424133301, 0.05095183849334717, -0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>We identified14 single nucleotide polymorphism...</td>\n",
       "      <td>single nucleotide polymorphisms (SNPs),</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.60760003</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.08011709153652191, -0.11200859397649765, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>We identified14 single nucleotide polymorphism...</td>\n",
       "      <td>aVal366Ala substitution</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.6528</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.08011709153652191, -0.11200859397649765, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>We identified14 single nucleotide polymorphism...</td>\n",
       "      <td>base-pair</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.419</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.08011709153652191, -0.11200859397649765, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>(bp) insertion/deletion.</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[[-0.025541335344314575, -0.2961934804916382, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>Ourexpression studies revealed the presence of...</td>\n",
       "      <td>Ourexpression studies</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.99075</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[0.4464527368545532, -0.14165955781936646, 0....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>The characterization of the KCNJ9 gene</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.62514997</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.5280818939208984, 0.036176640540361404, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>present</td>\n",
       "      <td>1.0</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>furtherstudies on the function of the KCNJ9 pr...</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.65725</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.5280818939208984, 0.036176640540361404, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>associated_with_someone_else</td>\n",
       "      <td>0.9991</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>evaluation</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.7473</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.5280818939208984, 0.036176640540361404, 0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>present</td>\n",
       "      <td>0.5169</td>\n",
       "      <td>The characterization of the KCNJ9 gene should ...</td>\n",
       "      <td>Type II diabetes</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.90096664</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.5280818939208984, 0.036176640540361404, 0...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d908b758-f5d0-4c10-87d2-2f0942ab02e1')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-d908b758-f5d0-4c10-87d2-2f0942ab02e1 button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-d908b758-f5d0-4c10-87d2-2f0942ab02e1');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "\n",
       "<div id=\"df-50893b5e-a286-4a62-abef-a2f29514f2a9\">\n",
       "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-50893b5e-a286-4a62-abef-a2f29514f2a9')\"\n",
       "            title=\"Suggest charts.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "  </button>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "      --bg-color: #E8F0FE;\n",
       "      --fill-color: #1967D2;\n",
       "      --hover-bg-color: #E2EBFA;\n",
       "      --hover-fill-color: #174EA6;\n",
       "      --disabled-fill-color: #AAA;\n",
       "      --disabled-bg-color: #DDD;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "      --bg-color: #3B4455;\n",
       "      --fill-color: #D2E3FC;\n",
       "      --hover-bg-color: #434B5C;\n",
       "      --hover-fill-color: #FFFFFF;\n",
       "      --disabled-bg-color: #3B4455;\n",
       "      --disabled-fill-color: #666;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart {\n",
       "    background-color: var(--bg-color);\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: var(--fill-color);\n",
       "    height: 32px;\n",
       "    padding: 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: var(--hover-bg-color);\n",
       "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: var(--button-hover-fill-color);\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart-complete:disabled,\n",
       "  .colab-df-quickchart-complete:disabled:hover {\n",
       "    background-color: var(--disabled-bg-color);\n",
       "    fill: var(--disabled-fill-color);\n",
       "    box-shadow: none;\n",
       "  }\n",
       "\n",
       "  .colab-df-spinner {\n",
       "    border: 2px solid var(--fill-color);\n",
       "    border-color: transparent;\n",
       "    border-bottom-color: var(--fill-color);\n",
       "    animation:\n",
       "      spin 1s steps(1) infinite;\n",
       "  }\n",
       "\n",
       "  @keyframes spin {\n",
       "    0% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "      border-left-color: var(--fill-color);\n",
       "    }\n",
       "    20% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    30% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    40% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    60% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    80% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "    90% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "  }\n",
       "</style>\n",
       "\n",
       "  <script>\n",
       "    async function quickchart(key) {\n",
       "      const quickchartButtonEl =\n",
       "        document.querySelector('#' + key + ' button');\n",
       "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
       "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
       "      try {\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      } catch (error) {\n",
       "        console.error('Error during call to suggestCharts:', error);\n",
       "      }\n",
       "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
       "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
       "    }\n",
       "    (() => {\n",
       "      let quickchartButtonEl =\n",
       "        document.querySelector('#df-50893b5e-a286-4a62-abef-a2f29514f2a9 button');\n",
       "      quickchartButtonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "    })();\n",
       "  </script>\n",
       "</div>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "                      assertion assertion_confidence  \\\n",
       "0                       present                  1.0   \n",
       "0                       present                  1.0   \n",
       "1                       present                  1.0   \n",
       "1  associated_with_someone_else               0.9859   \n",
       "2                           NaN                  NaN   \n",
       "3                       present                  1.0   \n",
       "3                       present                  1.0   \n",
       "3                       present                  1.0   \n",
       "4                           NaN                  NaN   \n",
       "5                       present                  1.0   \n",
       "6                       present                  1.0   \n",
       "6                       present                  1.0   \n",
       "6  associated_with_someone_else               0.9991   \n",
       "6                       present               0.5169   \n",
       "\n",
       "                                            document  \\\n",
       "0  The human KCNJ9 (Kir 3.3, GIRK3) is a member o...   \n",
       "0  The human KCNJ9 (Kir 3.3, GIRK3) is a member o...   \n",
       "1  Here we describe the genomicorganization of th...   \n",
       "1  Here we describe the genomicorganization of th...   \n",
       "2  The gene spansapproximately 7.6 kb and contain...   \n",
       "3  We identified14 single nucleotide polymorphism...   \n",
       "3  We identified14 single nucleotide polymorphism...   \n",
       "3  We identified14 single nucleotide polymorphism...   \n",
       "4                           (bp) insertion/deletion.   \n",
       "5  Ourexpression studies revealed the presence of...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "6  The characterization of the KCNJ9 gene should ...   \n",
       "\n",
       "                                   entities_clinical entities_clinical_class  \\\n",
       "0                               The human KCNJ9 (Kir                    TEST   \n",
       "0  the G-protein-activated inwardly rectifying po...                 PROBLEM   \n",
       "1                                    the KCNJ9 locus                    TEST   \n",
       "1                               II diabetes mellitus                 PROBLEM   \n",
       "2                                                NaN                     NaN   \n",
       "3            single nucleotide polymorphisms (SNPs),                 PROBLEM   \n",
       "3                            aVal366Ala substitution                 PROBLEM   \n",
       "3                                          base-pair               TREATMENT   \n",
       "4                                                NaN                     NaN   \n",
       "5                              Ourexpression studies                    TEST   \n",
       "6             The characterization of the KCNJ9 gene                    TEST   \n",
       "6  furtherstudies on the function of the KCNJ9 pr...                    TEST   \n",
       "6                                         evaluation                    TEST   \n",
       "6                                   Type II diabetes                 PROBLEM   \n",
       "\n",
       "  entities_clinical_confidence entities_clinical_origin_chunk  \\\n",
       "0                   0.57887995                              0   \n",
       "0                   0.50720996                              1   \n",
       "1                   0.37636665                              0   \n",
       "1                    0.8784333                              1   \n",
       "2                          NaN                            NaN   \n",
       "3                   0.60760003                              0   \n",
       "3                       0.6528                              1   \n",
       "3                        0.419                              2   \n",
       "4                          NaN                            NaN   \n",
       "5                      0.99075                              0   \n",
       "6                   0.62514997                              0   \n",
       "6                      0.65725                              1   \n",
       "6                       0.7473                              2   \n",
       "6                   0.90096664                              3   \n",
       "\n",
       "  entities_clinical_origin_sentence  \\\n",
       "0                                 0   \n",
       "0                                 0   \n",
       "1                                 0   \n",
       "1                                 0   \n",
       "2                               NaN   \n",
       "3                                 0   \n",
       "3                                 0   \n",
       "3                                 0   \n",
       "4                               NaN   \n",
       "5                                 0   \n",
       "6                                 0   \n",
       "6                                 0   \n",
       "6                                 0   \n",
       "6                                 0   \n",
       "\n",
       "                              word_embedding_biobert  \n",
       "0  [[-0.24800854921340942, 0.17330020666122437, 0...  \n",
       "0  [[-0.24800854921340942, 0.17330020666122437, 0...  \n",
       "1  [[0.013393104076385498, 0.005851382855325937, ...  \n",
       "1  [[0.013393104076385498, 0.005851382855325937, ...  \n",
       "2  [[-0.5425839424133301, 0.05095183849334717, -0...  \n",
       "3  [[0.08011709153652191, -0.11200859397649765, -...  \n",
       "3  [[0.08011709153652191, -0.11200859397649765, -...  \n",
       "3  [[0.08011709153652191, -0.11200859397649765, -...  \n",
       "4  [[-0.025541335344314575, -0.2961934804916382, ...  \n",
       "5  [[0.4464527368545532, -0.14165955781936646, 0....  \n",
       "6  [[-0.5280818939208984, 0.036176640540361404, 0...  \n",
       "6  [[-0.5280818939208984, 0.036176640540361404, 0...  \n",
       "6  [[-0.5280818939208984, 0.036176640540361404, 0...  \n",
       "6  [[-0.5280818939208984, 0.036176640540361404, 0...  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nlp.load(\"en.med_ner.clinical.biobert en.assert.biobert\").predict(['The human KCNJ9 (Kir 3.3, GIRK3) is a member of the G-protein-activated inwardly rectifying potassium (GIRK) channel family.',\n",
    "'Here we describe the genomicorganization of the KCNJ9 locus on chromosome 1q21-23 as a candidate gene forType II diabetes mellitus in the Pima Indian population.',\n",
    "'The gene spansapproximately 7.6 kb and contains one noncoding and two coding exons separated byapproximately 2.2 and approximately 2.6 kb introns, respectively.',\n",
    "'We identified14 single nucleotide polymorphisms (SNPs), including one that predicts aVal366Ala substitution, and an 8 base-pair', '(bp) insertion/deletion.',\n",
    "'Ourexpression studies revealed the presence of the transcript in various humantissues including pancreas, and two major insulin-responsive tissues: fat andskeletal muscle.',\n",
    "'The characterization of the KCNJ9 gene should facilitate furtherstudies on the function of the KCNJ9 protein and allow evaluation of thepotential role of the locus in Type II diabetes.'],output_level =  \"chunk\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ReXrvJhH6TZA"
   },
   "source": [
    "#### [Detect Assertion Status (assertion_dl_healthcare)](https://nlp.johnsnowlabs.com/2020/09/23/assertion_dl_healthcare_en.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 768
    },
    "id": "vaUFr-RR6TZC",
    "outputId": "98b3fa0e-ec02-4cdc-9e12-9b4162a4a219"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning::Spark Session already created, some configs may not take.\n",
      "Warning::Spark Session already created, some configs may not take.\n",
      "ner_clinical download started this may take some time.\n",
      "[OK!]\n",
      "assertion_dl_healthcare download started this may take some time.\n",
      "[OK!]\n",
      "embeddings_clinical download started this may take some time.\n",
      "Approximate size to download 1.6 GB\n",
      "[OK!]\n",
      "embeddings_healthcare_100d download started this may take some time.\n",
      "Approximate size to download 475.8 MB\n",
      "[OK!]\n",
      "Warning::Spark Session already created, some configs may not take.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-71c1ffbd-de7a-4044-82c7-9ef7ffd8e925\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>assertion</th>\n",
       "      <th>assertion_confidence</th>\n",
       "      <th>document</th>\n",
       "      <th>entities_clinical</th>\n",
       "      <th>entities_clinical_class</th>\n",
       "      <th>entities_clinical_confidence</th>\n",
       "      <th>entities_clinical_origin_chunk</th>\n",
       "      <th>entities_clinical_origin_sentence</th>\n",
       "      <th>word_embedding_glove_clinical</th>\n",
       "      <th>word_embedding_glove_healthcare_100d</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9973</td>\n",
       "      <td>Patient has a headache for the last 2 weeks an...</td>\n",
       "      <td>a headache</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.97025</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "      <td>[[-0.09624659270048141, 0.3514532148838043, -0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>0.9439</td>\n",
       "      <td>Patient has a headache for the last 2 weeks an...</td>\n",
       "      <td>anxious</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.9049</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "      <td>[[-0.09624659270048141, 0.3514532148838043, -0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>absent</td>\n",
       "      <td>0.9918</td>\n",
       "      <td>Patient has a headache for the last 2 weeks an...</td>\n",
       "      <td>alopecia</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.9978</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "      <td>[[-0.09624659270048141, 0.3514532148838043, -0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>absent</td>\n",
       "      <td>0.9994</td>\n",
       "      <td>Patient has a headache for the last 2 weeks an...</td>\n",
       "      <td>pain</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.9951</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "      <td>[[-0.09624659270048141, 0.3514532148838043, -0...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-71c1ffbd-de7a-4044-82c7-9ef7ffd8e925')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-71c1ffbd-de7a-4044-82c7-9ef7ffd8e925 button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-71c1ffbd-de7a-4044-82c7-9ef7ffd8e925');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "\n",
       "<div id=\"df-d2b2db69-c64c-4f42-8b9f-0888550d669b\">\n",
       "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-d2b2db69-c64c-4f42-8b9f-0888550d669b')\"\n",
       "            title=\"Suggest charts.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "  </button>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "      --bg-color: #E8F0FE;\n",
       "      --fill-color: #1967D2;\n",
       "      --hover-bg-color: #E2EBFA;\n",
       "      --hover-fill-color: #174EA6;\n",
       "      --disabled-fill-color: #AAA;\n",
       "      --disabled-bg-color: #DDD;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "      --bg-color: #3B4455;\n",
       "      --fill-color: #D2E3FC;\n",
       "      --hover-bg-color: #434B5C;\n",
       "      --hover-fill-color: #FFFFFF;\n",
       "      --disabled-bg-color: #3B4455;\n",
       "      --disabled-fill-color: #666;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart {\n",
       "    background-color: var(--bg-color);\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: var(--fill-color);\n",
       "    height: 32px;\n",
       "    padding: 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: var(--hover-bg-color);\n",
       "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: var(--button-hover-fill-color);\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart-complete:disabled,\n",
       "  .colab-df-quickchart-complete:disabled:hover {\n",
       "    background-color: var(--disabled-bg-color);\n",
       "    fill: var(--disabled-fill-color);\n",
       "    box-shadow: none;\n",
       "  }\n",
       "\n",
       "  .colab-df-spinner {\n",
       "    border: 2px solid var(--fill-color);\n",
       "    border-color: transparent;\n",
       "    border-bottom-color: var(--fill-color);\n",
       "    animation:\n",
       "      spin 1s steps(1) infinite;\n",
       "  }\n",
       "\n",
       "  @keyframes spin {\n",
       "    0% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "      border-left-color: var(--fill-color);\n",
       "    }\n",
       "    20% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    30% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    40% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    60% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    80% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "    90% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "  }\n",
       "</style>\n",
       "\n",
       "  <script>\n",
       "    async function quickchart(key) {\n",
       "      const quickchartButtonEl =\n",
       "        document.querySelector('#' + key + ' button');\n",
       "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
       "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
       "      try {\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      } catch (error) {\n",
       "        console.error('Error during call to suggestCharts:', error);\n",
       "      }\n",
       "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
       "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
       "    }\n",
       "    (() => {\n",
       "      let quickchartButtonEl =\n",
       "        document.querySelector('#df-d2b2db69-c64c-4f42-8b9f-0888550d669b button');\n",
       "      quickchartButtonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "    })();\n",
       "  </script>\n",
       "</div>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "  assertion assertion_confidence  \\\n",
       "0   present               0.9973   \n",
       "0   present               0.9439   \n",
       "0    absent               0.9918   \n",
       "0    absent               0.9994   \n",
       "\n",
       "                                            document entities_clinical  \\\n",
       "0  Patient has a headache for the last 2 weeks an...        a headache   \n",
       "0  Patient has a headache for the last 2 weeks an...           anxious   \n",
       "0  Patient has a headache for the last 2 weeks an...          alopecia   \n",
       "0  Patient has a headache for the last 2 weeks an...              pain   \n",
       "\n",
       "  entities_clinical_class entities_clinical_confidence  \\\n",
       "0                 PROBLEM                      0.97025   \n",
       "0                 PROBLEM                       0.9049   \n",
       "0                 PROBLEM                       0.9978   \n",
       "0                 PROBLEM                       0.9951   \n",
       "\n",
       "  entities_clinical_origin_chunk entities_clinical_origin_sentence  \\\n",
       "0                              0                                 0   \n",
       "0                              1                                 0   \n",
       "0                              2                                 0   \n",
       "0                              3                                 0   \n",
       "\n",
       "                       word_embedding_glove_clinical  \\\n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...   \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...   \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...   \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...   \n",
       "\n",
       "                word_embedding_glove_healthcare_100d  \n",
       "0  [[-0.09624659270048141, 0.3514532148838043, -0...  \n",
       "0  [[-0.09624659270048141, 0.3514532148838043, -0...  \n",
       "0  [[-0.09624659270048141, 0.3514532148838043, -0...  \n",
       "0  [[-0.09624659270048141, 0.3514532148838043, -0...  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nlp.load(\"en.med_ner.clinical en.assert.healthcare\").predict(['Patient has a headache for the last 2 weeks and appears anxious when she walks fast. No alopecia noted. She denies pain'],output_level =  \"chunk\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "VWzdXb8t6Tia"
   },
   "source": [
    "#### [Detect Assertion Status (DL Large)](https://nlp.johnsnowlabs.com/2020/05/21/assertion_dl_large_en.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "pKEpS_Tm6Tib",
    "outputId": "e7638966-676e-4fdf-c500-3e9c61a53df4"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning::Spark Session already created, some configs may not take.\n",
      "Warning::Spark Session already created, some configs may not take.\n",
      "ner_clinical download started this may take some time.\n",
      "[OK!]\n",
      "assertion_dl_large download started this may take some time.\n",
      "[OK!]\n",
      "embeddings_clinical download started this may take some time.\n",
      "Approximate size to download 1.6 GB\n",
      "[OK!]\n",
      "Warning::Spark Session already created, some configs may not take.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-f689aa31-5bf2-4838-8790-f0485018e80a\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>assertion</th>\n",
       "      <th>document</th>\n",
       "      <th>entities_clinical</th>\n",
       "      <th>entities_clinical_class</th>\n",
       "      <th>entities_clinical_confidence</th>\n",
       "      <th>entities_clinical_origin_chunk</th>\n",
       "      <th>entities_clinical_origin_sentence</th>\n",
       "      <th>word_embedding_glove</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>severe fever</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.89374995</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>sore throat</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.9813</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>absent</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>stomach pain</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.996</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>an epidural</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.9567</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>PCA</td>\n",
       "      <td>TREATMENT</td>\n",
       "      <td>0.9225</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>pain control</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.81995</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>conditional</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>short of breath</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.8959667</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>CT</td>\n",
       "      <td>TEST</td>\n",
       "      <td>0.9678</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>lung tumor</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.9139</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>present</td>\n",
       "      <td>Patient with severe fever and sore throat. He ...</td>\n",
       "      <td>Alzheimer</td>\n",
       "      <td>PROBLEM</td>\n",
       "      <td>0.9918</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>[[-0.08453157544136047, 0.20632991194725037, -...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-f689aa31-5bf2-4838-8790-f0485018e80a')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-f689aa31-5bf2-4838-8790-f0485018e80a button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-f689aa31-5bf2-4838-8790-f0485018e80a');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "\n",
       "<div id=\"df-d01a2bfd-280e-4c8e-ad74-263c722fff8f\">\n",
       "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-d01a2bfd-280e-4c8e-ad74-263c722fff8f')\"\n",
       "            title=\"Suggest charts.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "  </button>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "      --bg-color: #E8F0FE;\n",
       "      --fill-color: #1967D2;\n",
       "      --hover-bg-color: #E2EBFA;\n",
       "      --hover-fill-color: #174EA6;\n",
       "      --disabled-fill-color: #AAA;\n",
       "      --disabled-bg-color: #DDD;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "      --bg-color: #3B4455;\n",
       "      --fill-color: #D2E3FC;\n",
       "      --hover-bg-color: #434B5C;\n",
       "      --hover-fill-color: #FFFFFF;\n",
       "      --disabled-bg-color: #3B4455;\n",
       "      --disabled-fill-color: #666;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart {\n",
       "    background-color: var(--bg-color);\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: var(--fill-color);\n",
       "    height: 32px;\n",
       "    padding: 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: var(--hover-bg-color);\n",
       "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: var(--button-hover-fill-color);\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart-complete:disabled,\n",
       "  .colab-df-quickchart-complete:disabled:hover {\n",
       "    background-color: var(--disabled-bg-color);\n",
       "    fill: var(--disabled-fill-color);\n",
       "    box-shadow: none;\n",
       "  }\n",
       "\n",
       "  .colab-df-spinner {\n",
       "    border: 2px solid var(--fill-color);\n",
       "    border-color: transparent;\n",
       "    border-bottom-color: var(--fill-color);\n",
       "    animation:\n",
       "      spin 1s steps(1) infinite;\n",
       "  }\n",
       "\n",
       "  @keyframes spin {\n",
       "    0% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "      border-left-color: var(--fill-color);\n",
       "    }\n",
       "    20% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    30% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    40% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    60% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    80% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "    90% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "  }\n",
       "</style>\n",
       "\n",
       "  <script>\n",
       "    async function quickchart(key) {\n",
       "      const quickchartButtonEl =\n",
       "        document.querySelector('#' + key + ' button');\n",
       "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
       "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
       "      try {\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      } catch (error) {\n",
       "        console.error('Error during call to suggestCharts:', error);\n",
       "      }\n",
       "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
       "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
       "    }\n",
       "    (() => {\n",
       "      let quickchartButtonEl =\n",
       "        document.querySelector('#df-d01a2bfd-280e-4c8e-ad74-263c722fff8f button');\n",
       "      quickchartButtonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "    })();\n",
       "  </script>\n",
       "</div>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "     assertion                                           document  \\\n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0       absent  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0  conditional  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "0      present  Patient with severe fever and sore throat. He ...   \n",
       "\n",
       "  entities_clinical entities_clinical_class entities_clinical_confidence  \\\n",
       "0      severe fever                 PROBLEM                   0.89374995   \n",
       "0       sore throat                 PROBLEM                       0.9813   \n",
       "0      stomach pain                 PROBLEM                        0.996   \n",
       "0       an epidural               TREATMENT                       0.9567   \n",
       "0               PCA               TREATMENT                       0.9225   \n",
       "0      pain control                 PROBLEM                      0.81995   \n",
       "0   short of breath                 PROBLEM                    0.8959667   \n",
       "0                CT                    TEST                       0.9678   \n",
       "0        lung tumor                 PROBLEM                       0.9139   \n",
       "0         Alzheimer                 PROBLEM                       0.9918   \n",
       "\n",
       "  entities_clinical_origin_chunk entities_clinical_origin_sentence  \\\n",
       "0                              0                                 0   \n",
       "0                              1                                 0   \n",
       "0                              2                                 0   \n",
       "0                              3                                 0   \n",
       "0                              4                                 0   \n",
       "0                              5                                 0   \n",
       "0                              6                                 0   \n",
       "0                              7                                 0   \n",
       "0                              8                                 0   \n",
       "0                              9                                 0   \n",
       "\n",
       "                                word_embedding_glove  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  \n",
       "0  [[-0.08453157544136047, 0.20632991194725037, -...  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nlp.load(\"en.med_ner.clinical en.assert.large\").predict([\"\"\"Patient with severe fever and sore throat. He shows no stomach pain and he maintained on an epidural\n",
    "and PCA for pain control. He also became short of breath with climbing a flight of stairs. After CT, lung tumor located at the right lower lobe. Father with Alzheimer.\"\"\"],output_level =  \"chunk\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 324
    },
    "id": "6dVUUaOMyNSt",
    "outputId": "ca0187ab-0ab5-4d59-8333-f626e97f9699"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning::Spark Session already created, some configs may not take.\n",
      "Warning::Spark Session already created, some configs may not take.\n",
      "ner_wikiner_glove_840B_300 download started this may take some time.\n",
      "Approximate size to download 14.8 MB\n",
      "[OK!]\n",
      "assertion_dl_large download started this may take some time.\n",
      "[OK!]\n",
      "embeddings_clinical download started this may take some time.\n",
      "Approximate size to download 1.6 GB\n",
      "[OK!]\n",
      "glove_840B_300 download started this may take some time.\n",
      "Approximate size to download 2.3 GB\n",
      "[OK!]\n",
      "Warning::Spark Session already created, some configs may not take.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-136a6d04-7db8-4f9f-910d-15bd54e0ce3a\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>assertion</th>\n",
       "      <th>document</th>\n",
       "      <th>entities_wikiner_glove_840B_300</th>\n",
       "      <th>word_embedding_glove_840B_300</th>\n",
       "      <th>word_embedding_glove_clinical</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>He was cured of cancer! But is cough is still ...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[[0.02472599968314171, 0.273499995470047, 0.06...</td>\n",
       "      <td>[[-0.00917550828307867, -0.16478723287582397, ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-136a6d04-7db8-4f9f-910d-15bd54e0ce3a')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-136a6d04-7db8-4f9f-910d-15bd54e0ce3a button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-136a6d04-7db8-4f9f-910d-15bd54e0ce3a');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "  assertion                                           document  \\\n",
       "0       NaN  He was cured of cancer! But is cough is still ...   \n",
       "\n",
       "  entities_wikiner_glove_840B_300  \\\n",
       "0                             NaN   \n",
       "\n",
       "                       word_embedding_glove_840B_300  \\\n",
       "0  [[0.02472599968314171, 0.273499995470047, 0.06...   \n",
       "\n",
       "                       word_embedding_glove_clinical  \n",
       "0  [[-0.00917550828307867, -0.16478723287582397, ...  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = nlp.load(\"med_ner.clinical assert.large\").predict('He was cured of cancer! But is cough is still there',output_level =  \"chunk\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "id": "UzASczdVoJxD"
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "provenance": [],
   "toc_visible": true
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
